  
    //获取样式
    function getStyle(obj,attr){
        //obj是对象，attr是对象的属性
        //currentStyle 针对的是IE浏览器
        //getComputedStyle 针对火狐浏览器firefox
        if(obj.currentStyle){
            return obj.currentStyle[attr];
        }else{
            return document.defaultView.getComputedStyle(obj,false).getPropertyValue(attr);
            
        }
    }


    //每个物体运动都要抢定时器，所以给每个li加一个定时器
    //var timer = null;
    function startMove(obj,json, fn){
        
        
        //清空每次的定时器，所有的timer都要设置成当前的timer
        clearInterval(obj.timer);
        
        obj.timer = setInterval(function(){
            
            //假设所有的目标值都到达了终点
            var flag = true;
            //将获取的样式封装到一个对象中
            
            for( var attr in json){
                //1、取当前的值
                var icur = 0;
                if(attr == "opacity"){
                    //chrome浏览器可加可不加Math.round
                    icur = Math.round(parseFloat(getStyle(obj,attr))*100);
                }
                else{
                    icur = parseInt(getStyle(obj,attr));
                }

                //只能指定了是长度在变化
                //var speed = (target - obj.offsetLeft)/8;

                //2、算速度
                var speed = (json[attr] - icur)/10;
                speed = speed > 0 ? Math.ceil(speed) : Math.floor(speed);

                //3、检测停止
                if(icur != json[attr]){
                    flag = false;
                }
                
                
                if(attr == "opacity"){
                    obj.style.filter = "alpha(opacity:"+(icur + speed)+")";
                    obj.style.opacity = (icur + speed)/100;
                }else{
                    obj.style[attr] = icur + speed + 'px';
                }

            }
            
            
           if(flag){
             clearInterval(obj.timer);
                if(fn){
                   fn();
                }
            }
           
        },20);
    }
  